using System.Data.Entity.ModelConfiguration;

namespace CrawlerFramework.Models.Mapping
{
    public class LinkMap : EntityTypeConfiguration<Link>
    {
        public LinkMap()
        {
            // Primary Key
            HasKey(t => t.LinkId);

            // Properties
            Property(t => t.Url)
                .IsRequired()
                .HasMaxLength(250);


            // Table & Column Mappings
            ToTable("Link");
            Property(t => t.LinkId).HasColumnName("LinkId");
            Property(t => t.Url).HasColumnName("Url");
            Property(t => t.StartDate).HasColumnName("StartDate");
            Property(t => t.EndDate).HasColumnName("EndDate");
            Property(t => t.IsDelete).HasColumnName("IsDelete");
            Property(t => t.CrawlStatus).HasColumnName("CrawlStatus");
            Property(t => t.Page).HasColumnName("Page");
            Property(t => t.RelatedEntityId).HasColumnName("RelatedEntityId");
            Property(t => t.RelatedEntityName).HasColumnName("RelatedEntityName");

        }
    }
}
